package com.example.farm.mapper;

import com.example.farm.Bean.UserData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 姚
 * @since 2023-04-15
 */
@Mapper
public interface UserDataMapper extends BaseMapper<UserData> {

    //增
    @Insert("insert into userdata (uid,nickname,password,vip,land_purchased,item_purchased) values (#{uid},#{nickname},#{password},#{vip},#{landPurchased},#{itemPurchased})")
    int insert(UserData userData);


    //改
    @Delete("delete from userdata where uid = #{uid}")
    int updateById(UserData userData);


    //根据名字查找
    @Select("select * from userdata where nickname = #{nickname}")
    UserData selectByUserId(String nickname);


}
